package ipad.asia.service.punish;

import ipad.asia.entity.PunishConsumer;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.time.LocalDateTime;
import java.util.List;

@Component
@FeignClient(value = "PROVIDER-ADMIN")
public interface PunishConsumerFeign {

    /**
     * 获取所有的被投诉消费者，用户
     * @return
     */
    @RequestMapping("/admin/complaint/getAll")
     List<PunishConsumer> findAll();

    @RequestMapping("/admin/complaint/getById")
     PunishConsumer findById(@RequestParam(value = "id") int id);

    /**
     * 查看当前用户的所有投诉
     * @param consumerId
     * @return
     */
    @RequestMapping("/admin/complaint/getByConsumerId")
     List<PunishConsumer> findByConsumerId(@RequestParam(value = "consumerId") int consumerId);


    /**
     * 对被投诉的人做出处罚，不要轻易做出处罚，处罚一次，警告一次，第二次严重警告，第三次封号
     * 请查看数据库中punish_consumer的serious，默认为null，确认对他造成警告一次返回值一次为1，
     * 二次警告为2，三次警告为3.。。。一次为警告，二次为严重警告，三次为封号，具体请接查看api的ConsumerServiceFeign
     * @param
     */
    @RequestMapping("/admin/waring")
     void waring(@RequestParam(value = "consumerId") int consumerId);
    /**
     * 投诉消费者，用户
     * @param consumerId
     * @param reason
     * @param proof
     * @param reportEmail
     * @param date
     */
    @RequestMapping("/complaint/consumer")
     void complaintConsumer(@RequestParam(value = "consumerId",required = false)int consumerId,
                                  @RequestParam(value = "consumerName",required = false)String consumerName,
                                  @RequestParam(value = "reason",required = false)String reason,
                                  @RequestParam(value = "proof",required = false)String proof,
                                  @RequestParam(value = "reportEmail",required = false)String reportEmail,
                                  @RequestParam(value = "date",required = false)LocalDateTime date);


    @RequestMapping("/consumer/update")
     void update(@RequestParam(value = "statues",required = false) int statues,
                       @RequestParam(value = "serious",required = false)int serious,
                       @RequestParam(value = "result",required = false)String result,
                       @RequestParam(value = "id",required = false)int id);
}
